home *** CD-ROM | disk | FTP | other *** search
/ Windows Expert / Windows Expert.iso / windownt / awksrc.zip / GAWK-D~1.14 / GAWK~8.INF (.txt) < prev    next >
GNU Info File  |  1993-10-03  |  50KB  |  945 lines

  1. This is Info file gawk.info, produced by Makeinfo-1.47 from the input
  2. file gawk.texi.
  3.    This file documents `awk', a program that you can use to select
  4. particular records in a file and perform operations upon them.
  5.    This is Edition 0.14 of `The GAWK Manual',
  6. for the 2.14 version of the GNU implementation
  7. of AWK.
  8.    Copyright (C) 1989, 1991, 1992 Free Software Foundation, Inc.
  9.    Permission is granted to make and distribute verbatim copies of this
  10. manual provided the copyright notice and this permission notice are
  11. preserved on all copies.
  12.    Permission is granted to copy and distribute modified versions of
  13. this manual under the conditions for verbatim copying, provided that
  14. the entire resulting derived work is distributed under the terms of a
  15. permission notice identical to this one.
  16.    Permission is granted to copy and distribute translations of this
  17. manual into another language, under the above conditions for modified
  18. versions, except that this permission notice may be stated in a
  19. translation approved by the Foundation.
  20. File: gawk.info,  Node: Extracting,  Next: Distribution contents,  Prev: Gawk Distribution,  Up: Gawk Distribution
  21. Getting the `gawk' Distribution
  22. -------------------------------
  23.    `gawk' is distributed as a compressed `tar' file.  You can get it
  24. via anonymous `ftp' to the Internet host `prep.ai.mit.edu'. Like all
  25. GNU software, it will be archived at other well known systems, from
  26. which it will be possible to use some sort of anonymous `uucp' to
  27. obtain the distribution as well.
  28.    Once you have the distribution (for example, `gawk-2.14.0.tar.Z'),
  29. first use `uncompress' to expand the file, and then use `tar' to
  30. extract it. `uncompress' usually has a link named `zcat', which causes
  31. it to decompress the file to the standard output.  You can use the
  32. following pipeline to produce the `gawk' distribution:
  33.      # Under System V, add 'o' to the tar flags
  34.      zcat gawk-2.14.0.tar.Z | tar -xvpf -
  35. This will create a directory named `gawk-2.14' in the current directory.
  36.    The distribution file name is of the form `gawk-2.14.N.tar.Z'. The N
  37. represents a "patchlevel", meaning that minor bugs have been fixed in
  38. the major release.  The current patchlevel is 0, but when retrieving
  39. distributions, you should get the version with the highest patchlevel.
  40.    If you are not on a Unix system, you will need to make other
  41. arrangements for getting and extracting the `gawk' distribution.  You
  42. should consult a local expert.
  43. File: gawk.info,  Node: Distribution contents,  Prev: Extracting,  Up: Gawk Distribution
  44. Contents of the `gawk' Distribution
  45. -----------------------------------
  46.    `gawk' has a number of C source files, documentation files,
  47. subdirectories and files related to the configuration process (*note
  48. Compiling and Installing `gawk' on Unix: Unix Installation.), and
  49. several subdirectories related to different, non-Unix, operating
  50. systems.
  51. various `.c', `.y', and `.h' files
  52.      The C and YACC source files are the actual `gawk' source code.
  53. `README'
  54. `README.VMS'
  55. `README.dos'
  56. `README.rs6000'
  57. `README.ultrix'
  58.      Descriptive files: `README' for `gawk' under Unix, and the rest
  59.      for the various hardware and software combinations.
  60. `PORTS'
  61.      A list of systems to which `gawk' has been ported, and which have
  62.      successfully run the test suite.
  63. `ACKNOWLEDGMENT'
  64.      A list of the people who contributed major parts of the code or
  65.      documentation.
  66. `NEWS'
  67.      A list of changes to `gawk' since the last release or patch.
  68. `COPYING'
  69.      The GNU General Public License.
  70. `FUTURES'
  71.      A brief list of features and/or changes being contemplated for
  72.      future releases, with some indication of the time frame for the
  73.      feature, based on its difficulty.
  74. `LIMITATIONS'
  75.      A list of those factors that limit `gawk''s performance. Most of
  76.      these depend on the hardware or operating system software, and are
  77.      not limits in `gawk' itself.
  78. `PROBLEMS'
  79.      A file describing known problems with the current release.
  80. `gawk.1'
  81.      The `troff' source for a manual page describing `gawk'.
  82. `gawk.texinfo'
  83.      The `texinfo' source file for this Info file. It should be
  84.      processed with TeX to produce a printed manual, and with
  85.      `makeinfo' to produce the Info file.
  86. `Makefile.in'
  87. `config'
  88. `config.in'
  89. `configure'
  90. `missing'
  91. `mungeconf'
  92.      These files and subdirectories are used when configuring `gawk'
  93.      for various Unix systems.  They are explained in detail in *Note
  94.      Compiling and Installing `gawk' on Unix: Unix Installation.
  95. `atari'
  96.      Files needed for building `gawk' on an Atari ST. *Note Installing
  97.      `gawk' on the Atari ST: Atari Installation, for details.
  98.      Files needed for building `gawk' under MS-DOS. *Note Installing
  99.      `gawk' on MS-DOS: MS-DOS Installation, for details.
  100. `vms'
  101.      Files needed for building `gawk' under VMS. *Note Compiling
  102.      Installing and Running `gawk' on VMS: VMS Installation, for
  103.      details.
  104. `test'
  105.      Many interesting `awk' programs, provided as a test suite for
  106.      `gawk'.  You can use `make test' from the top level `gawk'
  107.      directory to run your version of `gawk' against the test suite.
  108.      There are many programs here that are useful in their own right.
  109.      If `gawk' successfully passes `make bigtest' then you can be
  110.      confident of a successful port.
  111. File: gawk.info,  Node: Unix Installation,  Next: VMS Installation,  Prev: Gawk Distribution,  Up: Installation
  112. Compiling and Installing `gawk' on Unix
  113. =======================================
  114.    Often, you can compile and install `gawk' by typing only two
  115. commands.  However, if you do not use a supported system, you may need
  116. to configure `gawk' for your system yourself.
  117. * Menu:
  118. * Quick Installation::          Compiling `gawk' on a
  119.                                 supported Unix version.
  120. * Configuration Philosophy::    How it's all supposed to work.
  121. * New Configurations::          What to do if there is no supplied
  122.                                 configuration for your system.
  123. File: gawk.info,  Node: Quick Installation,  Next: Configuration Philosophy,  Prev: Unix Installation,  Up: Unix Installation
  124. Compiling `gawk' for a Supported Unix Version
  125. ---------------------------------------------
  126.    After you have extracted the `gawk' distribution, `cd' to
  127. `gawk-2.14'.  Look in the `config' subdirectory for a file that matches
  128. your hardware/software combination.  In general, only the software is
  129. relevant; for example `sunos41' is used for SunOS 4.1, on both Sun 3
  130. and Sun 4 hardware.
  131.    If you find such a file, run the command:
  132.      # assume you have SunOS 4.1
  133.      ./configure sunos41
  134.    This produces a `Makefile' and `config.h' tailored to your system. 
  135. You may wish to edit the `Makefile' to use a different C compiler, such
  136. as `gcc', the GNU C compiler, if you have it. You may also wish to
  137. change the `CFLAGS' variable, which controls the command line options
  138. that are passed to the C compiler (such as optimization levels, or
  139. compiling for debugging).
  140.    After you have configured `Makefile' and `config.h', type:
  141.      make
  142. and shortly thereafter, you should have an executable version of `gawk'.
  143. That's all there is to it!
  144. File: gawk.info,  Node: Configuration Philosophy,  Next: New Configurations,  Prev: Quick Installation,  Up: Unix Installation
  145. The Configuration Process
  146. -------------------------
  147.    (This section is of interest only if you know something about using
  148. the C language and the Unix operating system.)
  149.    The source code for `gawk' generally attempts to adhere to industry
  150. standards wherever possible.  This means that `gawk' uses library
  151. routines that are specified by the ANSI C standard and by the POSIX
  152. operating system interface standard.  When using an ANSI C compiler,
  153. function prototypes are provided to help improve the compile-time
  154. checking.
  155.    Many older Unix systems do not support all of either the ANSI or the
  156. POSIX standards.  The `missing' subdirectory in the `gawk' distribution
  157. contains replacement versions of those subroutines that are most likely
  158. to be missing.
  159.    The `config.h' file that is created by the `configure' program
  160. contains definitions that describe features of the particular operating
  161. system where you are attempting to compile `gawk'.  For the most part,
  162. it lists which standard subroutines are *not* available. For example,
  163. if your system lacks the `getopt' routine, then `GETOPT_MISSING' would
  164. be defined.
  165.    `config.h' also defines constants that describe facts about your
  166. variant of Unix.  For example, there may not be an `st_blksize' element
  167. in the `stat' structure.  In this case `BLKSIZE_MISSING' would be
  168. defined.
  169.    Based on the list in `config.h' of standard subroutines that are
  170. missing, `missing.c' will do a `#include' of the appropriate file(s)
  171. from the `missing' subdirectory.
  172.    Conditionally compiled code in the other source files relies on the
  173. other definitions in the `config.h' file.
  174.    Besides creating `config.h', `configure' produces a `Makefile' from
  175. `Makefile.in'.  There are a number of lines in `Makefile.in' that are
  176. system or feature specific.  For example, there is line that begins
  177. with `##MAKE_ALLOCA_C##'.  This is normally a comment line, since it
  178. starts with `#'.  If a configuration file has `MAKE_ALLOCA_C' in it,
  179. then `configure' will delete the `##MAKE_ALLOCA_C##' from the beginning
  180. of the line.  This will enable the rules in the `Makefile' that use a C
  181. version of `alloca'.  There are several similar features that work in
  182. this fashion.
  183. File: gawk.info,  Node: New Configurations,  Prev: Configuration Philosophy,  Up: Unix Installation
  184. Configuring `gawk' for a New System
  185. -----------------------------------
  186.    (This section is of interest only if you know something about using
  187. the C language and the Unix operating system, and if you have to install
  188. `gawk' on a system that is not supported by the `gawk' distribution. If
  189. you are a C or Unix novice, get help from a local expert.)
  190.    If you need to configure `gawk' for a Unix system that is not
  191. supported in the distribution, first see *Note The Configuration
  192. Process: Configuration Philosophy. Then, copy `config.in' to
  193. `config.h', and copy `Makefile.in' to `Makefile'.
  194.    Next, edit both files.  Both files are liberally commented, and the
  195. necessary changes should be straightforward.
  196.    While editing `config.h', you need to determine what library
  197. routines you do or do not have by consulting your system documentation,
  198. or by perusing your actual libraries using the `ar' or `nm' utilities.
  199. In the worst case, simply do not define *any* of the macros for missing
  200. subroutines.  When you compile `gawk', the final link-editing step will
  201. fail.  The link editor will provide you with a list of unresolved
  202. external references--these are the missing subroutines.  Edit
  203. `config.h' again and recompile, and you should be set.
  204.    Editing the `Makefile' should also be straightforward.  Enable or
  205. disable the lines that begin with `##MAKE_WHATEVER##', as appropriate. 
  206. Select the correct C compiler and `CFLAGS' for it. Then run `make'.
  207.    Getting a correct configuration is likely to be an iterative process.
  208. Do not be discouraged if it takes you several tries.  If you have no
  209. luck whatsoever, please report your system type, and the steps you took.
  210. Once you do have a working configuration, please send it to the
  211. maintainers so that support for your system can be added to the
  212. official release.
  213.    *Note Reporting Problems and Bugs: Bugs, for information on how to
  214. report problems in configuring `gawk'.  You may also use the same
  215. mechanisms for sending in new configurations.
  216. File: gawk.info,  Node: VMS Installation,  Next: MS-DOS Installation,  Prev: Unix Installation,  Up: Installation
  217. Compiling, Installing, and Running `gawk' on VMS
  218. ================================================
  219.    This section describes how to compile and install `gawk' under VMS.
  220. * Menu:
  221. * VMS Compilation::             How to compile `gawk' under VMS.
  222. * VMS Installation Details::    How to install `gawk' under VMS.
  223. * VMS Running::                 How to run `gawk' under VMS.
  224. * VMS POSIX::                   Alternate instructions for VMS POSIX.
  225. File: gawk.info,  Node: VMS Compilation,  Next: VMS Installation Details,  Prev: VMS Installation,  Up: VMS Installation
  226. Compiling `gawk' under VMS
  227. --------------------------
  228.    To compile `gawk' under VMS, there is a `DCL' command procedure that
  229. will issue all the necessary `CC' and `LINK' commands, and there is
  230. also a `Makefile' for use with the `MMS' utility.  From the source
  231. directory, use either
  232.      $ @[.VMS]VMSBUILD.COM
  233.      $ MMS/DESCRIPTION=[.VMS]DECSRIP.MMS GAWK
  234.    Depending upon which C compiler you are using, follow one of the sets
  235. of instructions in this table:
  236. VAX C V3.x
  237.      Use either `vmsbuild.com' or `descrip.mms' as is.  These use
  238.      `CC/OPTIMIZE=NOLINE', which is essential for Version 3.0.
  239. VAX C V2.x
  240.      You must have Version 2.3 or 2.4; older ones won't work.  Edit
  241.      either `vmsbuild.com' or `descrip.mms' according to the comments
  242.      in them. For `vmsbuild.com', this just entails removing two `!'
  243.      delimiters. Also edit `config.h' (which is a copy of file
  244.      `[.config]vms-conf.h') and comment out or delete the two lines
  245.      `#define __STDC__ 0' and `#define VAXC_BUILTINS' near the end.
  246. GNU C
  247.      Edit `vmsbuild.com' or `descrip.mms'; the changes are different
  248.      from those for VAX C V2.x, but equally straightforward.  No
  249.      changes to `config.h' should be needed.
  250. DEC C
  251.      Edit `vmsbuild.com' or `descrip.mms' according to their comments.
  252.      No changes to `config.h' should be needed.
  253.    `gawk' 2.14 has been tested under VAX/VMS 5.5-1 using VAX C V3.2,
  254. GNU C 1.40 and 2.3.  It should work without modifications for VMS V4.6
  255. and up.
  256. File: gawk.info,  Node: VMS Installation Details,  Next: VMS Running,  Prev: VMS Compilation,  Up: VMS Installation
  257. Installing `gawk' on VMS
  258. ------------------------
  259.    To install `gawk', all you need is a "foreign" command, which is a
  260. `DCL' symbol whose value begins with a dollar sign.
  261.      $ GAWK :== $device:[directory]GAWK
  262. (Substitute the actual location of `gawk.exe' for
  263. `device:[directory]'.) The symbol should be placed in the `login.com'
  264. of any user who wishes to run `gawk', so that it will be defined every
  265. time the user logs on. Alternatively, the symbol may be placed in the
  266. system-wide `sylogin.com' procedure, which will allow all users to run
  267. `gawk'.
  268.    Optionally, the help entry can be loaded into a VMS help library:
  269.      $ LIBRARY/HELP SYS$HELP:HELPLIB [.VMS]GAWK.HLP
  270. (You may want to substitute a site-specific help library rather than
  271. the standard VMS library `HELPLIB'.)  After loading the help text,
  272.      $ HELP GAWK
  273. will provide information about both the `gawk' implementation and the
  274. `awk' programming language.
  275.    The logical name `AWK_LIBRARY' can designate a default location for
  276. `awk' program files.  For the `-f' option, if the specified filename
  277. has no device or directory path information in it, `gawk' will look in
  278. the current directory first, then in the directory specified by the
  279. translation of `AWK_LIBRARY' if the file was not found. If after
  280. searching in both directories, the file still is not found, then `gawk'
  281. appends the suffix `.awk' to the filename and the file search will be
  282. re-tried.  If `AWK_LIBRARY' is not defined, that portion of the file
  283. search will fail benignly.
  284. File: gawk.info,  Node: VMS Running,  Next: VMS POSIX,  Prev: VMS Installation Details,  Up: VMS Installation
  285. Running `gawk' on VMS
  286. ---------------------
  287.    Command line parsing and quoting conventions are significantly
  288. different on VMS, so examples in this manual or from other sources
  289. often need minor changes.  They *are* minor though, and all `awk'
  290. programs should run correctly.
  291.    Here are a couple of trivial tests:
  292.      $ gawk -- "BEGIN {print ""Hello, World!""}"
  293.      $ gawk -"W" version     ! could also be -"W version" or "-W version"
  294. Note that upper-case and mixed-case text must be quoted.
  295.    The VMS port of `gawk' includes a `DCL'-style interface in addition
  296. to the original shell-style interface (see the help entry for details).
  297. One side-effect of dual command line parsing is that if there is only a
  298. single parameter (as in the quoted string program above), the command
  299. becomes ambiguous.  To work around this, the normally optional `--'
  300. flag is required to force Unix style rather than `DCL' parsing.  If any
  301. other dash-type options (or multiple parameters such as data files to be
  302. processed) are present, there is no ambiguity and `--' can be omitted.
  303.    The default search path when looking for `awk' program files
  304. specified by the `-f' option is `"SYS$DISK:[],AWK_LIBRARY:"'.  The
  305. logical name `AWKPATH' can be used to override this default.  The format
  306. of `AWKPATH' is a comma-separated list of directory specifications.
  307. When defining it, the value should be quoted so that it retains a single
  308. translation, and not a multi-translation `RMS' searchlist.
  309. File: gawk.info,  Node: VMS POSIX,  Prev: VMS Running,  Up: VMS Installation
  310. Building and using `gawk' under VMS POSIX
  311. -----------------------------------------
  312.    Ignore the instructions above, although `vms/gawk.hlp' should still
  313. be made available in a help library.  Make sure that the two scripts,
  314. `configure' and `mungeconf', are executable; use `chmod +x' on them if
  315. necessary.  Then execute the following commands:
  316.      $ POSIX
  317.      psx> configure vms-posix
  318.      psx> make awktab.c gawk
  319. The first command will construct files `config.h' and `Makefile' out of
  320. templates.  The second command will compile and link `gawk'. Due to a
  321. `make' bug in VMS POSIX V1.0 and V1.1, the file `awktab.c' must be
  322. given as an explicit target or it will not be built and the final link
  323. step will fail.  Ignore the warning `"Could not find lib m in lib
  324. list"'; it is harmless, caused by the explicit use of `-lm' as a linker
  325. option which is not needed under VMS POSIX.  Under V1.1 (but not V1.0)
  326. a problem with the `yacc' skeleton `/etc/yyparse.c' will cause a
  327. compiler warning for `awktab.c', followed by a linker warning about
  328. compilation warnings in the resulting object module.  These warnings
  329. can be ignored.
  330.    Once built, `gawk' will work like any other shell utility.  Unlike
  331. the normal VMS port of `gawk', no special command line manipulation is
  332. needed in the VMS POSIX environment.
  333. File: gawk.info,  Node: MS-DOS Installation,  Next: Atari Installation,  Prev: VMS Installation,  Up: Installation
  334. Installing `gawk' on MS-DOS
  335. ===========================
  336.    The first step is to get all the files in the `gawk' distribution
  337. onto your PC.  Move all the files from the `pc' directory into the main
  338. directory where the other files are.  Edit the file `make.bat' so that
  339. it will be an acceptable MS-DOS batch file. This means making sure that
  340. all lines are terminated with the ASCII carriage return and line feed
  341. characters. restrictions.
  342.    `gawk' has only been compiled with version 5.1 of the Microsoft C
  343. compiler.  The file `make.bat' from the `pc' directory assumes that you
  344. have this compiler.
  345.    Copy the file `setargv.obj' from the library directory where it
  346. resides to the `gawk' source code directory.
  347.    Run `make.bat'.  This will compile `gawk' for you, and link it.
  348. That's all there is to it!
  349. File: gawk.info,  Node: Atari Installation,  Prev: MS-DOS Installation,  Up: Installation
  350. Installing `gawk' on the Atari ST
  351. =================================
  352.    This section assumes that you are running TOS.  It applies to other
  353. Atari models (STe, TT) as well.
  354.    In order to use `gawk', you need to have a shell, either text or
  355. graphics, that does not map all the characters of a command line to
  356. upper case.  Maintaining case distinction in option flags is very
  357. important (*note Invoking `awk': Command Line.).  Popular shells like
  358. `gulam' or `gemini' will work, as will newer versions of `desktop'. 
  359. Support for I/O redirection is necessary to make it easy to import
  360. `awk' programs from other environments.  Pipes are nice to have, but
  361. not vital.
  362.    If you have received an executable version of `gawk', place it, as
  363. usual, anywhere in your `PATH' where your shell will find it.
  364.    While executing, `gawk' creates a number of temporary files. `gawk'
  365. looks for either of the environment variables `TEMP' or `TMPDIR', in
  366. that order.  If either one is found, its value is assumed to be a
  367. directory for temporary files.  This directory must exist, and if you
  368. can spare the memory, it is a good idea to put it on a RAM drive.  If
  369. neither `TEMP' nor `TMPDIR' are found, then `gawk' uses the current
  370. directory for its temporary files.
  371.    The ST version of `gawk' searches for its program files as described
  372. in *Note The `AWKPATH' Environment Variable: AWKPATH Variable. On the
  373. ST, the default value for the `AWKPATH' variable is
  374. `".,c:\lib\awk,c:\gnu\lib\awk"'. The search path can be modified by
  375. explicitly setting `AWKPATH' to whatever you wish.  Note that colons
  376. cannot be used on the ST to separate elements in the `AWKPATH'
  377. variable, since they have another, reserved, meaning.  Instead, you
  378. must use a comma to separate elements in the path. If you are
  379. recompiling `gawk' on the ST, then you can choose a new default search
  380. path, by setting the value of `DEFPATH' in the file `...\config\atari'.
  381.  You may choose a different separator character by setting the value of
  382. `ENVSEP' in the same file.  The new values will be used when creating
  383. the header file `config.h'.
  384.    Although `awk' allows great flexibility in doing I/O redirections
  385. from within a program, this facility should be used with care on the ST.
  386. In some circumstances the OS routines for file handle pool processing
  387. lose track of certain events, causing the computer to crash, and
  388. requiring a reboot.  Often a warm reboot is sufficient.  Fortunately,
  389. this happens infrequently, and in rather esoteric situations.  In
  390. particular, avoid having one part of an `awk' program using `print'
  391. statements explicitly redirected to `"/dev/stdout"', while other
  392. `print' statements use the default standard output, and a calling shell
  393. has redirected standard output to a file.
  394.    When `gawk' is compiled with the ST version of `gcc' and its usual
  395. libraries, it will accept both `/' and `\' as path separators. While
  396. this is convenient, it should be remembered that this removes one,
  397. technically legal, character (`/') from your file names, and that it
  398. may create problems for external programs, called via the `system()'
  399. function, which may not support this convention.  Whenever it is
  400. possible that a file created by `gawk' will be used by some other
  401. program, use only backslashes.  Also remember that in `awk',
  402. backslashes in strings have to be doubled in order to get literal
  403. backslashes.
  404.    The initial port of `gawk' to the ST was done with `gcc'. If you
  405. wish to recompile `gawk' from scratch, you will need to use a compiler
  406. that accepts ANSI standard C (such as `gcc', Turbo C, or Prospero C). 
  407. If `sizeof(int) != sizeof(int *)', the correctness of the generated
  408. code depends heavily on the fact that all function calls have function
  409. prototypes in the current scope.  If your compiler does not accept
  410. function prototypes, you will probably have to add a number of casts to
  411. the code.
  412.    If you are using `gcc', make sure that you have up-to-date libraries.
  413. Older versions have problems with some library functions (`atan2()',
  414. `strftime()', the `%g' conversion in `sprintf()') which may affect the
  415. operation of `gawk'.
  416.    In the `atari' subdirectory of the `gawk' distribution is a version
  417. of the `system()' function that has been tested with `gulam' and `msh';
  418. it should work with other shells as well. With `gulam', it passes the
  419. string to be executed without spawning an extra copy of a shell.  It is
  420. possible to replace this version of `system()' with a similar function
  421. from a library or from some other source if that version would be a
  422. better choice for the shell you prefer.
  423.    The files needed to recompile `gawk' on the ST can be found in the
  424. `atari' directory.  The provided files and instructions below assume
  425. that you have the GNU C compiler (`gcc'), the `gulam' shell, and an ST
  426. version of `sed'. The `Makefile' is set up to use `byacc' as a `yacc'
  427. replacement.  With a different set of tools some adjustments and/or
  428. editing will be needed.
  429.    `cd' to the `atari' directory.  Copy `Makefile.st' to `makefile' in
  430. the source (parent) directory.  Possibly adjust `../config/atari' to
  431. suit your system.  Execute the script `mkconf.g' which will create the
  432. header file `../config.h'.  Go back to the source directory.  If you
  433. are not using `gcc', check the file `missing.c'. It may be necessary to
  434. change forward slashes in the references to files from the `atari'
  435. subdirectory into backslashes.  Type `make' and enjoy.
  436.    Compilation with `gcc' of some of the bigger modules, like
  437. `awk_tab.c', may require a full four megabytes of memory.  On smaller
  438. machines you would need to cut down on optimizations, or you would have
  439. to switch to another, less memory hungry, compiler.
  440. File: gawk.info,  Node: Gawk Summary,  Next: Sample Program,  Prev: Installation,  Up: Top
  441. `gawk' Summary
  442. **************
  443.    This appendix provides a brief summary of the `gawk' command line
  444. and the `awk' language.  It is designed to serve as "quick reference." 
  445. It is therefore terse, but complete.
  446. * Menu:
  447. * Command Line Summary::        Recapitulation of the command line.
  448. * Language Summary::            A terse review of the language.
  449. * Variables/Fields::            Variables, fields, and arrays.
  450. * Rules Summary::               Patterns and Actions, and their
  451.                                 component parts.
  452. * Functions Summary::           Defining and calling functions.
  453. * Historical Features::         Some undocumented but supported "features".
  454. File: gawk.info,  Node: Command Line Summary,  Next: Language Summary,  Prev: Gawk Summary,  Up: Gawk Summary
  455. Command Line Options Summary
  456. ============================
  457.    The command line consists of options to `gawk' itself, the `awk'
  458. program text (if not supplied via the `-f' option), and values to be
  459. made available in the `ARGC' and `ARGV' predefined `awk' variables:
  460.      awk [`-FFS'] [`-W' GAWK-OPTS] [`-v VAR=VAL'] [`--'] 'PROGRAM' FILE ...
  461.      awk [`-FFS'] [`-W' GAWK-OPTS] [`-v VAR=VAL'] `-f' SOURCE-FILE [`-f SOURCE-FILE ...'] FILE ...
  462.    The options that `gawk' accepts are:
  463. `-FFS'
  464.      Use FS for the input field separator (the value of the `FS'
  465.      predefined variable).
  466. `-f PROGRAM-FILE'
  467.      Read the `awk' program source from the file PROGRAM-FILE, instead
  468.      of from the first command line argument.
  469. `-v VAR=VAL'
  470.      Assign the variable VAR the value VAL before program execution
  471.      begins.
  472. `-W compat'
  473.      Specifies compatibility mode, in which `gawk' extensions are turned
  474.      off.
  475. `-W posix'
  476.      Specifies POSIX compatibility mode, in which `gawk' extensions are
  477.      turned off and additional restrictions apply.
  478. `-W version'
  479.      Print version information for this particular copy of `gawk' on
  480.      the error output.  This option may disappear in a future version
  481.      of `gawk'.
  482. `-W copyleft'
  483. `-W copyright'
  484.      Print the short version of the General Public License on the error
  485.      output.  This option may disappear in a future version of `gawk'.
  486. `-W lint'
  487.      Give warnings about dubious or non-portable `awk' constructs.
  488.      Signal the end of options.  This is useful to allow further
  489.      arguments to the `awk' program itself to start with a `-'.  This
  490.      is mainly for consistency with the argument parsing conventions of
  491.      POSIX.
  492.    Any other options are flagged as invalid, but are otherwise ignored.
  493. *Note Invoking `awk': Command Line, for more details.
  494. File: gawk.info,  Node: Language Summary,  Next: Variables/Fields,  Prev: Command Line Summary,  Up: Gawk Summary
  495. Language Summary
  496. ================
  497.    An `awk' program consists of a sequence of pattern-action statements
  498. and optional function definitions.
  499.      PATTERN    { ACTION STATEMENTS }
  500.      
  501.      function NAME(PARAMETER LIST)     { ACTION STATEMENTS }
  502.    `gawk' first reads the program source from the PROGRAM-FILE(s) if
  503. specified, or from the first non-option argument on the command line. 
  504. The `-f' option may be used multiple times on the command line.  `gawk'
  505. reads the program text from all the PROGRAM-FILE files, effectively
  506. concatenating them in the order they are specified.  This is useful for
  507. building libraries of `awk' functions, without having to include them
  508. in each new `awk' program that uses them.  To use a library function in
  509. a file from a program typed in on the command line, specify `-f
  510. /dev/tty'; then type your program, and end it with a `Control-d'. *Note
  511. Invoking `awk': Command Line.
  512.    The environment variable `AWKPATH' specifies a search path to use
  513. when finding source files named with the `-f' option.  The default
  514. path, which is `.:/usr/lib/awk:/usr/local/lib/awk' is used if `AWKPATH'
  515. is not set. If a file name given to the `-f' option contains a `/'
  516. character, no path search is performed. *Note The `AWKPATH' Environment
  517. Variable: AWKPATH Variable, for a full description of the `AWKPATH'
  518. environment variable.
  519.    `gawk' compiles the program into an internal form, and then proceeds
  520. to read each file named in the `ARGV' array.  If there are no files
  521. named on the command line, `gawk' reads the standard input.
  522.    If a "file" named on the command line has the form `VAR=VAL', it is
  523. treated as a variable assignment: the variable VAR is assigned the
  524. value VAL. If any of the files have a value that is the null string,
  525. that element in the list is skipped.
  526.    For each line in the input, `gawk' tests to see if it matches any
  527. PATTERN in the `awk' program.  For each pattern that the line matches,
  528. the associated ACTION is executed.
  529. File: gawk.info,  Node: Variables/Fields,  Next: Rules Summary,  Prev: Language Summary,  Up: Gawk Summary
  530. Variables and Fields
  531. ====================
  532.    `awk' variables are dynamic; they come into existence when they are
  533. first used.  Their values are either floating-point numbers or strings.
  534. `awk' also has one-dimension arrays; multiple-dimensional arrays may be
  535. simulated.  There are several predefined variables that `awk' sets as a
  536. program runs; these are summarized below.
  537. * Menu:
  538. * Fields Summary::              Input field splitting.
  539. * Built-in Summary::            `awk''s built-in variables.
  540. * Arrays Summary::              Using arrays.
  541. * Data Type Summary::           Values in `awk' are numbers or strings.
  542. File: gawk.info,  Node: Fields Summary,  Next: Built-in Summary,  Prev: Variables/Fields,  Up: Variables/Fields
  543. Fields
  544. ------
  545.    As each input line is read, `gawk' splits the line into FIELDS,
  546. using the value of the `FS' variable as the field separator.  If `FS'
  547. is a single character, fields are separated by that character. 
  548. Otherwise, `FS' is expected to be a full regular expression.  In the
  549. special case that `FS' is a single blank, fields are separated by runs
  550. of blanks and/or tabs.  Note that the value of `IGNORECASE' (*note
  551. Case-sensitivity in Matching: Case-sensitivity.) also affects how
  552. fields are split when `FS' is a regular expression.
  553.    Each field in the input line may be referenced by its position, `$1',
  554. `$2', and so on.  `$0' is the whole line.  The value of a field may be
  555. assigned to as well.  Field numbers need not be constants:
  556.      n = 5
  557.      print $n
  558. prints the fifth field in the input line.  The variable `NF' is set to
  559. the total number of fields in the input line.
  560.    References to nonexistent fields (i.e., fields after `$NF') return
  561. the null-string.  However, assigning to a nonexistent field (e.g.,
  562. `$(NF+2) = 5') increases the value of `NF', creates any intervening
  563. fields with the null string as their value, and causes the value of
  564. `$0' to be recomputed, with the fields being separated by the value of
  565. `OFS'.
  566.    *Note Reading Input Files: Reading Files, for a full description of
  567. the way `awk' defines and uses fields.
  568. File: gawk.info,  Node: Built-in Summary,  Next: Arrays Summary,  Prev: Fields Summary,  Up: Variables/Fields
  569. Built-in Variables
  570. ------------------
  571.    `awk''s built-in variables are:
  572. `ARGC'
  573.      The number of command line arguments (not including options or the
  574.      `awk' program itself).
  575. `ARGV'
  576.      The array of command line arguments.  The array is indexed from 0
  577.      to `ARGC' - 1.  Dynamically changing the contents of `ARGV' can
  578.      control the files used for data.
  579. `CONVFMT'
  580.      The conversion format to use when converting numbers to strings.
  581. `FIELDWIDTHS'
  582.      A space separated list of numbers describing the fixed-width input
  583.      data.
  584. `ENVIRON'
  585.      An array containing the values of the environment variables.  The
  586.      array is indexed by variable name, each element being the value of
  587.      that variable.  Thus, the environment variable `HOME' would be in
  588.      `ENVIRON["HOME"]'.  Its value might be `/u/close'.
  589.      Changing this array does not affect the environment seen by
  590.      programs which `gawk' spawns via redirection or the `system'
  591.      function. (This may change in a future version of `gawk'.)
  592.      Some operating systems do not have environment variables. The
  593.      array `ENVIRON' is empty when running on these systems.
  594. `FILENAME'
  595.      The name of the current input file.  If no files are specified on
  596.      the command line, the value of `FILENAME' is `-'.
  597. `FNR'
  598.      The input record number in the current input file.
  599.      The input field separator, a blank by default.
  600. `IGNORECASE'
  601.      The case-sensitivity flag for regular expression operations.  If
  602.      `IGNORECASE' has a nonzero value, then pattern matching in rules,
  603.      field splitting with `FS', regular expression matching with `~'
  604.      and `!~', and the `gsub', `index', `match', `split' and `sub'
  605.      predefined functions all ignore case when doing regular expression
  606.      operations.
  607.      The number of fields in the current input record.
  608.      The total number of input records seen so far.
  609. `OFMT'
  610.      The output format for numbers for the `print' statement, `"%.6g"'
  611.      by default.
  612. `OFS'
  613.      The output field separator, a blank by default.
  614. `ORS'
  615.      The output record separator, by default a newline.
  616.      The input record separator, by default a newline.  `RS' is
  617.      exceptional in that only the first character of its string value
  618.      is used for separating records.  If `RS' is set to the null
  619.      string, then records are separated by blank lines.  When `RS' is
  620.      set to the null string, then the newline character always acts as
  621.      a field separator, in addition to whatever value `FS' may have.
  622. `RSTART'
  623.      The index of the first character matched by `match'; 0 if no match.
  624. `RLENGTH'
  625.      The length of the string matched by `match'; -1 if no match.
  626. `SUBSEP'
  627.      The string used to separate multiple subscripts in array elements,
  628.      by default `"\034"'.
  629.    *Note Built-in Variables::, for more information.
  630. File: gawk.info,  Node: Arrays Summary,  Next: Data Type Summary,  Prev: Built-in Summary,  Up: Variables/Fields
  631. Arrays
  632. ------
  633.    Arrays are subscripted with an expression between square brackets
  634. (`[' and `]').  Array subscripts are *always* strings; numbers are
  635. converted to strings as necessary, following the standard conversion
  636. rules (*note Conversion of Strings and Numbers: Conversion.).
  637.    If you use multiple expressions separated by commas inside the square
  638. brackets, then the array subscript is a string consisting of the
  639. concatenation of the individual subscript values, converted to strings,
  640. separated by the subscript separator (the value of `SUBSEP').
  641.    The special operator `in' may be used in an `if' or `while'
  642. statement to see if an array has an index consisting of a particular
  643. value.
  644.      if (val in array)
  645.              print array[val]
  646.    If the array has multiple subscripts, use `(i, j, ...) in array' to
  647. test for existence of an element.
  648.    The `in' construct may also be used in a `for' loop to iterate over
  649. all the elements of an array. *Note Scanning all Elements of an Array:
  650. Scanning an Array.
  651.    An element may be deleted from an array using the `delete' statement.
  652.    *Note Arrays in `awk': Arrays, for more detailed information.
  653. File: gawk.info,  Node: Data Type Summary,  Prev: Arrays Summary,  Up: Variables/Fields
  654. Data Types
  655. ----------
  656.    The value of an `awk' expression is always either a number or a
  657. string.
  658.    Certain contexts (such as arithmetic operators) require numeric
  659. values.  They convert strings to numbers by interpreting the text of
  660. the string as a numeral.  If the string does not look like a numeral,
  661. it converts to 0.
  662.    Certain contexts (such as concatenation) require string values. They
  663. convert numbers to strings by effectively printing them with `sprintf'.
  664. *Note Conversion of Strings and Numbers: Conversion, for the details.
  665.    To force conversion of a string value to a number, simply add 0 to
  666. it.  If the value you start with is already a number, this does not
  667. change it.
  668.    To force conversion of a numeric value to a string, concatenate it
  669. with the null string.
  670.    The `awk' language defines comparisons as being done numerically if
  671. both operands are numeric, or if one is numeric and the other is a
  672. numeric string.  Otherwise one or both operands are converted to
  673. strings and a string comparison is performed.
  674.    Uninitialized variables have the string value `""' (the null, or
  675. empty, string).  In contexts where a number is required, this is
  676. equivalent to 0.
  677.    *Note Variables::, for more information on variable naming and
  678. initialization; *note Conversion of Strings and Numbers: Conversion.,
  679. for more information on how variable values are interpreted.
  680. File: gawk.info,  Node: Rules Summary,  Next: Functions Summary,  Prev: Variables/Fields,  Up: Gawk Summary
  681. Patterns and Actions
  682. ====================
  683. * Menu:
  684. * Pattern Summary::             Quick overview of patterns.
  685. * Regexp Summary::              Quick overview of regular expressions.
  686. * Actions Summary::             Quick overview of actions.
  687.    An `awk' program is mostly composed of rules, each consisting of a
  688. pattern followed by an action.  The action is enclosed in `{' and `}'. 
  689. Either the pattern may be missing, or the action may be missing, but,
  690. of course, not both.  If the pattern is missing, the action is executed
  691. for every single line of input.  A missing action is equivalent to this
  692. action,
  693.      { print }
  694. which prints the entire line.
  695.    Comments begin with the `#' character, and continue until the end of
  696. the line.  Blank lines may be used to separate statements.  Normally, a
  697. statement ends with a newline, however, this is not the case for lines
  698. ending in a `,', `{', `?', `:', `&&', or `||'.  Lines ending in `do' or
  699. `else' also have their statements automatically continued on the
  700. following line.  In other cases, a line can be continued by ending it
  701. with a `\', in which case the newline is ignored.
  702.    Multiple statements may be put on one line by separating them with a
  703. `;'. This applies to both the statements within the action part of a
  704. rule (the usual case), and to the rule statements.
  705.    *Note Comments in `awk' Programs: Comments, for information on
  706. `awk''s commenting convention; *note `awk' Statements versus Lines:
  707. Statements/Lines., for a description of the line continuation mechanism
  708. in `awk'.
  709. File: gawk.info,  Node: Pattern Summary,  Next: Regexp Summary,  Prev: Rules Summary,  Up: Rules Summary
  710. Patterns
  711. --------
  712.    `awk' patterns may be one of the following:
  713.      /REGULAR EXPRESSION/
  714.      RELATIONAL EXPRESSION
  715.      PATTERN && PATTERN
  716.      PATTERN || PATTERN
  717.      PATTERN ? PATTERN : PATTERN
  718.      (PATTERN)
  719.      ! PATTERN
  720.      PATTERN1, PATTERN2
  721.      BEGIN
  722.      END
  723.    `BEGIN' and `END' are two special kinds of patterns that are not
  724. tested against the input.  The action parts of all `BEGIN' rules are
  725. merged as if all the statements had been written in a single `BEGIN'
  726. rule.  They are executed before any of the input is read.  Similarly,
  727. all the `END' rules are merged, and executed when all the input is
  728. exhausted (or when an `exit' statement is executed).  `BEGIN' and `END'
  729. patterns cannot be combined with other patterns in pattern expressions.
  730. `BEGIN' and `END' rules cannot have missing action parts.
  731.    For `/REGULAR-EXPRESSION/' patterns, the associated statement is
  732. executed for each input line that matches the regular expression. 
  733. Regular expressions are extensions of those in `egrep', and are
  734. summarized below.
  735.    A RELATIONAL EXPRESSION may use any of the operators defined below in
  736. the section on actions.  These generally test whether certain fields
  737. match certain regular expressions.
  738.    The `&&', `||', and `!' operators are logical "and," logical "or,"
  739. and logical "not," respectively, as in C.  They do short-circuit
  740. evaluation, also as in C, and are used for combining more primitive
  741. pattern expressions.  As in most languages, parentheses may be used to
  742. change the order of evaluation.
  743.    The `?:' operator is like the same operator in C.  If the first
  744. pattern matches, then the second pattern is matched against the input
  745. record; otherwise, the third is matched.  Only one of the second and
  746. third patterns is matched.
  747.    The `PATTERN1, PATTERN2' form of a pattern is called a range
  748. pattern.  It matches all input lines starting with a line that matches
  749. PATTERN1, and continuing until a line that matches PATTERN2, inclusive.
  750.  A range pattern cannot be used as an operand to any of the pattern
  751. operators.
  752.    *Note Patterns::, for a full description of the pattern part of `awk'
  753. rules.
  754. File: gawk.info,  Node: Regexp Summary,  Next: Actions Summary,  Prev: Pattern Summary,  Up: Rules Summary
  755. Regular Expressions
  756. -------------------
  757.    Regular expressions are the extended kind found in `egrep'. They are
  758. composed of characters as follows:
  759.      matches the character C (assuming C is a character with no special
  760.      meaning in regexps).
  761.      matches the literal character C.
  762.      matches any character except newline.
  763.      matches the beginning of a line or a string.
  764.      matches the end of a line or a string.
  765. `[ABC...]'
  766.      matches any of the characters ABC... (character class).
  767. `[^ABC...]'
  768.      matches any character except ABC... and newline (negated character
  769.      class).
  770. `R1|R2'
  771.      matches either R1 or R2 (alternation).
  772. `R1R2'
  773.      matches R1, and then R2 (concatenation).
  774.      matches one or more R's.
  775.      matches zero or more R's.
  776.      matches zero or one R's.
  777. `(R)'
  778.      matches R (grouping).
  779.    *Note Regular Expressions as Patterns: Regexp, for a more detailed
  780. explanation of regular expressions.
  781.    The escape sequences allowed in string constants are also valid in
  782. regular expressions (*note Constant Expressions: Constants.).
  783. File: gawk.info,  Node: Actions Summary,  Prev: Regexp Summary,  Up: Rules Summary
  784. Actions
  785. -------
  786.    Action statements are enclosed in braces, `{' and `}'. Action
  787. statements consist of the usual assignment, conditional, and looping
  788. statements found in most languages.  The operators, control statements,
  789. and input/output statements available are patterned after those in C.
  790. * Menu:
  791. * Operator Summary::            `awk' operators.
  792. * Control Flow Summary::        The control statements.
  793. * I/O Summary::                 The I/O statements.
  794. * Printf Summary::              A summary of `printf'.
  795. * Special File Summary::        Special file names interpreted internally.
  796. * Numeric Functions Summary::   Built-in numeric functions.
  797. * String Functions Summary::    Built-in string functions.
  798. * Time Functions Summary::      Built-in time functions.
  799. * String Constants Summary::    Escape sequences in strings.
  800. File: gawk.info,  Node: Operator Summary,  Next: Control Flow Summary,  Prev: Actions Summary,  Up: Actions Summary
  801. Operators
  802. .........
  803.    The operators in `awk', in order of increasing precedence, are:
  804. `= += -= *= /= %= ^='
  805.      Assignment.  Both absolute assignment (`VAR=VALUE') and operator
  806.      assignment (the other forms) are supported.
  807.      A conditional expression, as in C.  This has the form `EXPR1 ?
  808.      EXPR2 : EXPR3'.  If EXPR1 is true, the value of the expression is
  809.      EXPR2; otherwise it is EXPR3.  Only one of EXPR2 and EXPR3 is
  810.      evaluated.
  811.      Logical "or".
  812.      Logical "and".
  813. `~ !~'
  814.      Regular expression match, negated match.
  815. `< <= > >= != =='
  816.      The usual relational operators.
  817. `BLANK'
  818.      String concatenation.
  819. `+ -'
  820.      Addition and subtraction.
  821. `* / %'
  822.      Multiplication, division, and modulus.
  823. `+ - !'
  824.      Unary plus, unary minus, and logical negation.
  825.      Exponentiation (`**' may also be used, and `**=' for the assignment
  826.      operator, but they are not specified in the POSIX standard).
  827. `++ --'
  828.      Increment and decrement, both prefix and postfix.
  829.      Field reference.
  830.    *Note Expressions as Action Statements: Expressions, for a full
  831. description of all the operators listed above. *Note Examining Fields:
  832. Fields, for a description of the field reference operator.
  833. File: gawk.info,  Node: Control Flow Summary,  Next: I/O Summary,  Prev: Operator Summary,  Up: Actions Summary
  834. Control Statements
  835. ..................
  836.    The control statements are as follows:
  837.      if (CONDITION) STATEMENT [ else STATEMENT ]
  838.      while (CONDITION) STATEMENT
  839.      do STATEMENT while (CONDITION)
  840.      for (EXPR1; EXPR2; EXPR3) STATEMENT
  841.      for (VAR in ARRAY) STATEMENT
  842.      break
  843.      continue
  844.      delete ARRAY[INDEX]
  845.      exit [ EXPRESSION ]
  846.      { STATEMENTS }
  847.    *Note Control Statements in Actions: Statements, for a full
  848. description of all the control statements listed above.
  849. File: gawk.info,  Node: I/O Summary,  Next: Printf Summary,  Prev: Control Flow Summary,  Up: Actions Summary
  850. I/O Statements
  851. ..............
  852.    The input/output statements are as follows:
  853. `getline'
  854.      Set `$0' from next input record; set `NF', `NR', `FNR'.
  855. `getline <FILE'
  856.      Set `$0' from next record of FILE; set `NF'.
  857. `getline VAR'
  858.      Set VAR from next input record; set `NF', `FNR'.
  859. `getline VAR <FILE'
  860.      Set VAR from next record of FILE.
  861. `next'
  862.      Stop processing the current input record.  The next input record
  863.      is read and processing starts over with the first pattern in the
  864.      `awk' program. If the end of the input data is reached, the `END'
  865.      rule(s), if any, are executed.
  866. `next file'
  867.      Stop processing the current input file.  The next input record
  868.      read comes from the next input file.  `FILENAME' is updated, `FNR'
  869.      is set to 1, and processing starts over with the first pattern in
  870.      the `awk' program. If the end of the input data is reached, the
  871.      `END' rule(s), if any, are executed.
  872. `print'
  873.      Prints the current record.
  874. `print EXPR-LIST'
  875.      Prints expressions.
  876. `print EXPR-LIST > FILE'
  877.      Prints expressions on FILE.
  878. `printf FMT, EXPR-LIST'
  879.      Format and print.
  880. `printf FMT, EXPR-LIST > file'
  881.      Format and print on FILE.
  882.    Other input/output redirections are also allowed.  For `print' and
  883. `printf', `>> FILE' appends output to the FILE, and `| COMMAND' writes
  884. on a pipe.  In a similar fashion, `COMMAND | getline' pipes input into
  885. `getline'. `getline' returns 0 on end of file, and -1 on an error.
  886.    *Note Explicit Input with `getline': Getline, for a full description
  887. of the `getline' statement. *Note Printing Output: Printing, for a full
  888. description of `print' and `printf'.  Finally, *note The `next'
  889. Statement: Next Statement., for a description of how the `next'
  890. statement works.
  891. File: gawk.info,  Node: Printf Summary,  Next: Special File Summary,  Prev: I/O Summary,  Up: Actions Summary
  892. `printf' Summary
  893. ................
  894.    The `awk' `printf' statement and `sprintf' function accept the
  895. following conversion specification formats:
  896.      An ASCII character.  If the argument used for `%c' is numeric, it
  897.      is treated as a character and printed.  Otherwise, the argument is
  898.      assumed to be a string, and the only first character of that
  899.      string is printed.
  900.      A decimal number (the integer part).
  901.      A floating point number of the form `[-]d.ddddddE[+-]dd'.
  902.      A floating point number of the form [`-']`ddd.dddddd'.
  903.      Use `%e' or `%f' conversion, whichever produces a shorter string,
  904.      with nonsignificant zeros suppressed.
  905.      An unsigned octal number (again, an integer).
  906.      A character string.
  907.      An unsigned hexadecimal number (an integer).
  908.      Like `%x', except use `A' through `F' instead of `a' through `f'
  909.      for decimal 10 through 15.
  910.      A single `%' character; no argument is converted.
  911.    There are optional, additional parameters that may lie between the
  912. `%' and the control letter:
  913.      The expression should be left-justified within its field.
  914. `WIDTH'
  915.      The field should be padded to this width.  If WIDTH has a leading
  916.      zero, then the field is padded with zeros.  Otherwise it is padded
  917.      with blanks.
  918. `.PREC'
  919.      A number indicating the maximum width of strings or digits to the
  920.      right of the decimal point.
  921.    Either or both of the WIDTH and PREC values may be specified as `*'.
  922.  In that case, the particular value is taken from the argument list.
  923.    *Note Using `printf' Statements for Fancier Printing: Printf, for
  924. examples and for a more detailed description.
  925. File: gawk.info,  Node: Special File Summary,  Next: Numeric Functions Summary,  Prev: Printf Summary,  Up: Actions Summary
  926. Special File Names
  927. ..................
  928.    When doing I/O redirection from either `print' or `printf' into a
  929. file, or via `getline' from a file, `gawk' recognizes certain special
  930. file names internally.  These file names allow access to open file
  931. descriptors inherited from `gawk''s parent process (usually the shell).
  932.  The file names are:
  933. `/dev/stdin'
  934.      The standard input.
  935. `/dev/stdout'
  936.      The standard output.
  937. `/dev/stderr'
  938.      The standard error output.
  939. `/dev/fd/N'
  940.      The file denoted by the open file descriptor N.
  941. These file names may also be used on the command line to name data
  942. files.
  943.    *Note Standard I/O Streams: Special Files, for a longer description
  944. that provides the motivation for this feature.
  945.